package team.headnurse.nursemanagement.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import team.headnurse.nursemanagement.dao.VacationExpectationDao;
import team.headnurse.nursemanagement.model.VacationExpectation;
import team.headnurse.nursemanagement.service.VacationExpectationService;

import javax.annotation.Resource;

/**
 * @author Eugene-Forest
 */
@Transactional(rollbackFor = Exception.class)
@Service
public class VacationExpectationServiceImpl implements VacationExpectationService {

    @Resource
    private VacationExpectationDao vacationExpectationDao;

    /**
     * 插入一条假期期望记录
     *
     * @param expectation 假期期望对象
     * @return 如果成功则返回数字1
     */
    @Override
    public int insert(VacationExpectation expectation) {
        return vacationExpectationDao.insert(expectation);
    }

    /**
     * 通过id查找一条假期期望记录
     *
     * @param staffId  员工id
     * @param priority 优先级
     * @return 如果成功则返回一个假期期望对象
     */
    @Override
    public VacationExpectation selectById(String staffId, int priority) {
        return vacationExpectationDao.selectById(staffId, priority);
    }

    /**
     * 更新一条假期期望记录
     *
     * @param expectation 假期期望对象
     * @return 如果成功则返回数字1
     */
    @Override
    public int update(VacationExpectation expectation) {
        return vacationExpectationDao.update(expectation);
    }

    /**
     * 删除一条假期期望记录
     *
     * @param expectation 假期期望对象
     * @return 如果成功则返回数字1
     */
    @Override
    public int delete(VacationExpectation expectation) {
        return vacationExpectationDao.delete(expectation);
    }
}
